<?php
namespace DAOZHEN\D;
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); 
header("Cache-Control: no-cache, must-revalidate"); 
header("Pragma: no-cache"); 
// 制定允许其他域名访问
header("Access-Control-Allow-Origin:*");
// 响应类型
header("Access-Control-Allow-Methods:POST");
// 响应头设置
header("Access-Control-Allow-Headers:x-requested-with, content-type");
ini_set("date.timezone","Asia/Shanghai");
define("SIGNATURE","BRAVEGUO");
define("ISZHMVCAPIBUG",FALSE);
include(dirname(dirname(dirname(__FILE__)))."/zhconfig/Config.php");

if(ISZHMVCAPIBUG==true)
{
    error_reporting(E_ALL);
    ini_set("display_errors", "1");
}
else
{
    error_reporting(0);//E_ALL 0
    ini_set("display_errors", "0");//1 0
}
$token = SafeRequest(getPGC("token"), 0);
$timestamp = SafeRequest(getPGC("timestamp"), 0);
$randomstr = SafeRequest(getPGC("randomstr"), 0);
$zhmvcdbtype = SafeRequest(getPGC("zhmvcdbtype"), 0);
$data = trim(getPGC("data"));

$rs1=new \DAOZHEN\D\Queues();
if($zhmvcdbtype=="getdata")
{
    $datas=$rs1->getAll();
    $rows            = $rs1->getRowCount();
    for ($i = 0; $i < $rows; $i++) {
        $datas[$i]["button"]["id"]=$datas[$i]["id"];
    }
    $returnS["data"]=$datas;
}
elseif($zhmvcdbtype=="updateone")
{
    $data=json_decode($data,true);
    $rs1->update();
}
elseif($zhmvcdbtype=="del")
{
    $data=json_decode($data,true);
    $rs1->delete($data);
}
elseif($zhmvcdbtype=="add")
{
    $rs1->addOne();
}

$returnS["data"]=$datas;

$result = json_encode($returnS);
echo $result;
exit();